package com.example.novelstory.controller.dxy;

import com.example.novelstory.entity.Advert;
import com.example.novelstory.service.dxy.AdvertServicelmpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * author:daixiaoyi
 */

@Api(tags = "广告管理")
@CrossOrigin
@RestController
public class AdvertController {
    @Resource
    AdvertServicelmpl advertService;

    @PostMapping(value = "/findadvertAll")
//    @ResponseBody
    @ApiOperation(value = "全查4")
    public List<Advert> findadvertAll() {
//        List<Advert> alladvertUser = advertService.findadvertAll();
        return advertService.list();
    }

//    @ResponseBody
    @PostMapping(value = "/addadvert")
    @ApiOperation(value = "增加4")
    public Boolean addadvertInfo(Advert advert){
//        List<Advert> addadvertInfo = advertService.addadvertInfo(advertid,advertname,advertlink);
        return advertService.addadvertInfo(advert);

    }

//    @ResponseBody
    @PostMapping(value = "/deleteadvert")
    @ApiOperation(value = "删除4")
    public Boolean deleteadvertInfo(int advertid) {
//        List<Advert> deleteadvertInfo = advertService.deleteadvertInfo(id);
        return advertService.deleteadvertInfo(advertid);

    }

    @ResponseBody
    @PostMapping(value = "/updeteadvert")
    @ApiOperation(value = "修改4")
    public Boolean updeteadvertInfo(Advert advert) {
//        List<Advert> updeteadvertInfo = advertService.updeteadvertInfo(advertid,advertname,advertlink);
        return advertService.updeteadvertInfo(advert);
    }
}
